package com.wztk.shydemo.gsondemo;

import android.support.v7.app.AppCompatActivity;
import android.widget.EditText;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import static com.wztk.shydemo.R.styleable.View;

/**
 * Created by win7 on 2016/7/2.
 */
public class GsonDemoMain {
    public  GsonDemoMain(){
    }
    public String start(){
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        GsonDemo gsonDemo1  = new GsonDemo();
        gsonDemo1.setName("lilei");
        gsonDemo1.setAge("100");
        gsonDemo1.setArea("xm");
        String sjson1 = gson.toJson(gsonDemo1);
        String sjson2;
        GsonDemo gsonDemo2 = gson.fromJson(sjson1, GsonDemo.class);
        sjson1 = sjson1 + "\n\n\n\n" + gsonDemo2.toString();
        return  sjson1;
    }
}
